from nl2sql.similarity.cosine_similarity import CosineSimilarity
from nl2sql.model.embedding_model import EmbeddingModel
from nl2sql.similarity.levenshtein_similarity import LevenshteinSimilarity

# 传统的相似度计算方法：
ls = LevenshteinSimilarity()

# 现代的相似度计算方法:
apikey = "sk-68ac5f5ccf3540ba834deeeaecb48987"
em = EmbeddingModel(api_key=apikey)
cs = CosineSimilarity(embedding_model=em)

# 计算候选项的相似度

target = "华科"
candidates = ['华南科技大学', '华北科技大学', '中华科技大学', '华中科技大学']

best_match_ls = ls.find_best_match(target=target, candidates=candidates)
best_match_cs = cs.find_best_match(target=target, candidates=candidates)

best_match_cs = candidates[best_match_cs[0][0]]
print("传统方法的最佳匹配结果", best_match_ls)
print("现代方法的最佳匹配结果", best_match_cs)
